package com.dust.yuheadline.common.utils;

import lombok.Getter;

/**
 * @author 高翔宇
 * @since 2024/10/21 周一 00:05
 */
@Getter
public enum ResponseCode {
    // 成功
    SUCCESS(200, "成功"),

    // 客户端错误
    BAD_REQUEST(400, "请求参数错误"),
    EMAIL_ALREADY_EXISTS(400, "邮箱已存在"),
    USERNAME_EXIST(400, "用户名已存在"),
    VERIFICATION_CODE_INVALID(400, "验证码无效"),
    VERIFICATION_CODE_EXPIRED(400, "验证码已过期"),
    CONFIRM_PASSWORD_ERROR(400, "两次输入的密码不一致"),
    USERNAME_OR_PASSWORD_INVALID(400, "用户名或密码错误"),

    // 未授权
    UNAUTHORIZED(401, "未授权"),
    INVALID_CREDENTIALS(401, "用户名或密码错误"),
    NOT_LOGIN(401, "用户未登录"),
    FORBIDDEN(403, "禁止访问"),
    ACCOUNT_LOCKED(403, "账户已被锁定"),

    // 资源未找到
    NOT_FOUND(404, "资源未找到"),
    USER_NOT_FOUND(404, "用户不存在"),

    // 服务器错误
    INTERNAL_SERVER_ERROR(500, "内部服务器错误"),
    SERVICE_UNAVAILABLE(503, "服务不可用"),
    FILE_READ_FAILED(500, "文件读取失败"),
    FILE_NAME_IS_NULL(500, "文件名为空"),
    FILE_EMPTY(500, "文件大小为0"),
    UPLOAD_FAILED(500, "文件上传失败"),
    RESOURCE_NOT_FOUND(404, "资源不存在");

    private final int code;
    private final String message;

    ResponseCode(int code, String message) {
        this.code = code;
        this.message = message;
    }
}